package org.example.springboot.service;

import org.apache.ibatis.annotations.Param;
import org.example.springboot.dao.SuppliersMapper;
import org.example.springboot.model.Suppliers;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class SuppliersService {
    @Autowired
    private SuppliersMapper suppliersMapper;

    public String insertSuppliers(String supplierName,String address,String website,String status, String bankName, String bankAccount,String contactPerson,String contactPhone,String description){
        suppliersMapper.insertSuppliers(supplierName,address,website,status, bankName, bankAccount,contactPerson,contactPhone,description);
        return "succeed";
    }

    public List<Suppliers> getAllSuppliers(){
        return suppliersMapper.getAllSuppliers();
    }

    public List<Suppliers> getAllSuppliersName(){
        return suppliersMapper.getAllSuppliersName();
    }

    public List<Suppliers> findSuppliers(String keyword){
        return suppliersMapper.findSuppliers(keyword);
    }


    public Suppliers findSuppliersById(int id){
        return suppliersMapper.findSuppliersById(id);
    }

    public void deleteById(int id){
        suppliersMapper.deleteById(id);
    }
}
